package exercises.Charpter8;

import java.util.Random;


class Point extends Circle{
	@Override
	public void draw(){System.out.println("Point.draw()");}
	@Override
	public void erase(){System.out.println("Point.erase()");}
	@Override
	public void test(){System.out.println("Point.test()");}
}

class RandomShapeGenerator1{
	private Random rand = new Random(47);
	public Shape next(){
		switch (rand.nextInt(4)){
		default:
		case 0: return new Circle();
		case 1: return new Square();
		case 2: return new Triangle();
		case 3: return new Point();
		}
	}
}

public class Four {
	private static RandomShapeGenerator1 gen = new RandomShapeGenerator1();
	public static void main(String[] args){
		Shape[] s = new Shape[20];
		for (int i = 0; i < 20; i++){
			s[i] = gen.next();
			s[i].draw();
		}
	}
}
